﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ServiceStack.OrmLite;
using LPY.LeHealth.DTO;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;

namespace LPY.LeHealth.DAL
{
    public class combo2DAL : GenericBaseDAL<combo2DTO>
    {
        string constring = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
        /// <summary>
        /// 显示套餐信息
        /// </summary>
        /// <returns></returns>
        public List<combo2DTO> getcombo2list()
        {
            List<combo2DTO> list = new List<combo2DTO>();
           using(SqlConnection conn=new SqlConnection (constring))
           {
               conn.Open();
               string sql="select * from combo2";
               SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
               DataTable dt = new DataTable();
               adapter.Fill(dt);
              
               foreach (DataRow item in dt.Rows)
               {
                   combo2DTO com = new combo2DTO();
                   com.Cid = Convert.ToInt32(item["Cid"]);
                   com.Cname = item["Cname"].ToString();
                   com.Cnowprice =Convert.ToDecimal(item["Cnowprice"]);
                   com.CpicUrl = item["CpicUrl"].ToString();
                   com.Cprice = Convert.ToDecimal(item["Cprice"]);
                   com.Csonnum = Convert.ToInt32(item["Csonnum"]);
                   list.Add(com);
               }
           }
           return list;
        }
     
    }
}
